//
//  MYMyUserInfoEditVC.m
//  MuYing
//
//  Created by tbb on 2019/8/7.
//  Copyright © 2019 TBB. All rights reserved.
//

#import "MYMyUserInfoEditVC.h"
#import "MYMyUserInfoEditTextFieldCell.h"
@interface MYMyUserInfoEditVC ()

@end

@implementation MYMyUserInfoEditVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isNavShadow = YES;
    self.navigationItem.title = kYQLS(@"编辑昵称");
    self.rightItemTitle = kYQLS(@"保存");
}

-(void)setupView {
    [super setupView];
    kYQREGISTERTABLEVIEWNIBCELL(@"MYMyUserInfoEditTextFieldCell");
}

-(void)rightItemAction:(UIButton *)sender {
    [self.view endEditing:true];

    MYMyUserInfoEditTextFieldCell *cell = [self.listTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
    if ([cell.textField.text removeStringSpace].length == 0) {
        [QMUITips showError:kYQLS(@"请输入") inView:self.view hideAfterDelay:1];
        return;
    }
    if (self.textFieldblock) {
        self.textFieldblock(cell.textField.text, self.indexPath);
        [self.navigationController popViewControllerAnimated:true];
    }
}


#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    MYMyUserInfoEditTextFieldCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MYMyUserInfoEditTextFieldCell"];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 58;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.001;
}
#pragma mark - UITableViewDelegate, UITableViewDataSource end


@end
